package com.hzlx;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hzlx.bean.Course;
import com.hzlx.dto.CourseDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface CourseDao extends BaseMapper<Course> {
    String findSql = "select c.*, t.username teacherName,u.username " +
            "from users u " +
            "inner join users_course uc on u.id = uc.users_id " +
            "inner join course c on c.id = uc.course_id " +
            "inner join teacher_course tc on tc.course_id = c.id " +
            "inner join teacher t on tc.teacher_id = t.id " +
            "where u.account = #{account}";
    @Select(findSql)
    IPage<CourseDto> findByUsersAccount(IPage<?> page, @Param("account") String account);
}
